﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TimeAxis.Admin.Manager
{
    public partial class ProjectEdit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DavidDB.ADO.DBManager db = new DavidDB.ADO.DBManager();
                Interfaces.ICategory iCategory = Impls.ImplCategory.GetInstance(db);
                Models.Category c = new Models.Category();
                c = iCategory.GetModel(Convert.ToInt32(Request.QueryString["docid"]));
                this.UserName.Text = c.CName;
                db.Commit();
                db.Dispose();
            }
        }

        protected void LoginButton_Click(object sender, EventArgs e)
        {
            DavidDB.ADO.DBManager dbmanager = new DavidDB.ADO.DBManager();
            Interfaces.ICategory iCategory = Impls.ImplCategory.GetInstance(dbmanager);
            Models.Category c = new Models.Category();
            c.Id = Convert.ToInt32(Request.QueryString["docid"]);
            c.CName = this.UserName.Text;
            iCategory.Edit(c);
            dbmanager.Commit();
            dbmanager.Dispose();
            Response.Redirect("ProjectManager.aspx");
        }
    }
}